package cn.wolfcode.controller;

import cn.wolfcode.domain.Book;
import cn.wolfcode.query.QueryObject;
import cn.wolfcode.service.BookService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/book")
public class BookController {

    @Autowired
    private BookService bookService;

    @RequestMapping("/list")
    public String selectList(Model model, QueryObject queryObject) {
        PageInfo<Book> pageInfo = bookService.selectAll(queryObject);
        model.addAttribute("pageInfo", pageInfo);
        return "book/list";
    }
}
